# -*- coding: utf-8 -*-
from xlrd import open_workbook,cellname, cellnameabs, colname

wb = open_workbook('1.xls')
for s in wb.sheets():
    print 'Sheet:',s.name
    for row in range(s.nrows):
        values = []
        for col in range(s.ncols):
            value = s.cell(row,col).value
            type = s.cell(row,col).ctype
            if isinstance(value,float):
                value = str(value)[:-2].encode("utf-8")
            if value != "": #去掉空格
                values.append(value)
        if len(values): #去掉空行
            print ','.join(values)

sheet = wb.sheet_by_index(0)
for row_index in range(sheet.nrows):
    for col_index in range(sheet.ncols):
        print cellname(row_index,col_index),'-',
        print sheet.cell(row_index,col_index).value

print sheet.row(0)
print sheet.col(0)
print
print sheet.row_slice(0,1)
print sheet.row_slice(0,1,2)
print sheet.row_values(0,1)
print sheet.row_values(0,1,2)
print sheet.row_types(0,1)
print sheet.row_types(0,1,2)
print

print cellname(0,0),cellname(10,10),cellname(100,100)
print cellnameabs(3,1),cellnameabs(41,59),cellnameabs(265,358)
print colname(0),colname(10),colname(100)